package com.cy.singleton;
/**
 * <br>@class: EnumSingleton
 * <br>@description: 枚举型单例
 * <br>@author: cy
 * <br>@date: 2020-03-28 22:06:58
 * <br>@version: 1.0
 * <br>
 * <br>@since: (版本) 作者 时间 注释
 */
public enum EnumSingleton {
    INSTANCE;

    public void print() {
        System.out.println(this.hashCode());
    }

    public static void main(String[] args) {
        EnumSingleton s1 = EnumSingleton.INSTANCE;
        EnumSingleton s2 = EnumSingleton.INSTANCE;
        EnumSingleton s3 = EnumSingleton.INSTANCE;
        EnumSingleton s4 = EnumSingleton.INSTANCE;
        EnumSingleton s5 = EnumSingleton.INSTANCE;
        System.out.println(s1==s2);
        System.out.println(s1==s5);
    }
}
